<template>
    <div>
        <van-field :label="label"
                   :rule="rule"
                   :type="type"
                   :placeholder="placeholder"
                   v-model="inputContent"
        />
    </div>
</template>

<script>
    export default {
        name: "LoginText",
        data(){
            return{
                inputContent:''
            }
        },
        props:['text','label','rule','type','placeholder'],
        watch:{
            inputContent(){
                this.changeInput()
            }
        },
        methods:{
            changeInput(){
                const rules = new RegExp(this.rule)
                if (rules.test(this.inputContent)) {
                    this.$emit('inputChange',this.inputContent)
                }
            }
        }
    }
</script>

<style scoped>

</style>